Skip to content

Conversation

Copy link

Copilot AI commented Jul 18, 2025

This PR implements the --consolidated-results feature from the original PR grosser#630 by grosser/parallel_tests, adding a switch to log test results like tests per process, time taken, and total failures to a specified JSON file.

Changes Made

Core Functionality

  • Added --consolidated-results [PATH] CLI option that accepts a file path where consolidated test results will be written as JSON
  • Modified test execution flow to collect consolidated results throughout the test run process
  • Added JSON output functionality that writes comprehensive test execution data to the specified file

Runner Updates

Updated all test runners to support consolidated results:

  • Test::Runner - Base test runner with result summarization
  • RSpec::Runner - RSpec-specific runner with colorized output support
  • Cucumber::Runner - Cucumber runner with scenario grouping
  • Gherkin::Runner - Gherkin runner with step/scenario counting

JSON Output Structure

The consolidated results JSON contains:

{
  "tests": {
    "message": "3 processes for 3 tests, ~ 1 test per process",
    "tests": 3,
    "processes": 3, 
    "tests_per_process": 1
  },
  "summary": {
    "example": 6,
    "failure": 1,
    "message": "6 examples, 1 failure"
  },
  "time_taken": {
    "seconds": 2,
    "message": "Took 2 seconds"
  }
}

Quiet Mode Support

  • Enhanced quiet mode to still collect consolidated results when --consolidated-results is specified
  • Preserves existing behavior where quiet mode suppresses output but now optionally collects data

Usage Examples

# Basic usage - writes results to results.json
parallel_test --consolidated-results results.json

# With specific number of processes
parallel_rspec -n 4 --consolidated-results rspec_results.json spec/

# In quiet mode (still generates JSON)
parallel_cucumber --quiet --consolidated-results cucumber_results.json features/

Use Cases

This feature is particularly useful for:

  • CI/CD pipelines that need structured test result data
  • GitHub status checks integration
  • Test reporting dashboards
  • Performance monitoring of parallel test execution
  • Build system integration requiring machine-readable test results

Testing

  • ✅ Verified functionality across all test runners (test, rspec, cucumber, gherkin)
  • ✅ Confirmed proper JSON structure generation
  • ✅ Tested quiet mode integration
  • ✅ Updated all related test specs to handle new parameters
  • ✅ Validated CLI help text and option parsing

The implementation maintains backward compatibility while adding the new consolidated results functionality seamlessly across all parallel test runners.

This pull request was created as a result of the following prompt from Copilot chat.

Apply the changes from PR grosser#630 (Add switch to log results to JSON file) to a new branch based on the latest master branch. This should introduce a --consolidated-results switch to log test results like tests per process, time taken, and total failures to a specified JSON file. Update the CLI, cucumber, gherkin, and test runners, and adjust related specs as needed. Reference the changes and implementation from the original PR grosser#630 in grosser/parallel_tests.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits July 18, 2025 05:13
Co-authored-by: deepakmahakale <14993828+deepakmahakale@users.noreply.github.com>
Co-authored-by: deepakmahakale <14993828+deepakmahakale@users.noreply.github.com>
Co-authored-by: deepakmahakale <14993828+deepakmahakale@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --consolidated-results switch for logging test results to JSON file Add --consolidated-results switch to log test results to JSON file Jul 18, 2025
Copilot AI requested a review from deepakmahakale July 18, 2025 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants